package com.jsh.erp.datasource.mappers;

import com.jsh.erp.datasource.entities.*;
import com.jsh.erp.datasource.vo.*;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

public interface AccountHeadMapperEx {

    List<AccountHeadVo4ListEx> selectByConditionAccountHead(
            @Param("type") String type,
            @Param("creatorArray") String[] creatorArray,
            @Param("billNo") String billNo,
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("organId") String organId,
            @Param("creator") String creator,
            @Param("handsPersonId") String handsPersonId,
            @Param("accountId") String accountId,
            @Param("status") String[] status,
            @Param("remark") String remark,
            @Param("offset") Integer offset,
            @Param("rows") Integer rows);

    Long countsByAccountHead(
            @Param("type") String type,
            @Param("creatorArray") String[] creatorArray,
            @Param("billNo") String billNo,
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("organId") String organId,
            @Param("creator") String creator,
            @Param("handsPersonId") String handsPersonId,
            @Param("accountId") String accountId,
            @Param("status") String status,
            @Param("remark") String remark);

    BigDecimal findAllMoney(
            @Param("supplierId") String supplierId,
            @Param("type") String type,
            @Param("modeName") String modeName,
            @Param("endTime") String endTime);

    List<AccountHeadVo4ListEx> getDetailByNumber(
            @Param("billNo") String billNo);

    int batchDeleteAccountHeadByIds(@Param("updateTime") Date updateTime, @Param("updater") String updater, @Param("ids") String[] ids);

    List<AccountHead> getAccountHeadListByAccountIds(@Param("accountIds") String[] accountIds);

    List<AccountHead> getAccountHeadListByOrganIds(@Param("organIds") String[] organIds);

    List<AccountHead> getAccountHeadListByHandsPersonIds(@Param("handsPersonIds") String[] handsPersonIds);

    List<AccountHead> getFinancialBillNoByBillId(
            @Param("billId") String billId);

    List<AccountHeadVo> getListByOrganId(@Param("organId") String organId, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("number")String number, @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize);

    List<AccountHeadVo> getAllBillByOrganId(@Param("organId") String organId,
                                                  @Param("beginTime") String beginTime,
                                                  @Param("endTime") String endTime,
                                                  @Param("number")String number,
                                                  @Param("pageNum") Integer pageNum,
                                                  @Param("pageSize") Integer pageSize);
    int getAllBillByOrganIdCount(
            @Param("organId") String organId,
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("number")String number);


    List<BigDecimal> getAccountHeadByOrganId(@Param("organId") String organId,@Param("billTime") Date billTime);
    List<BigDecimal> getAccountItemByOrganId(@Param("organId") String organId,@Param("id") String id);

//    BigDecimal getBalance(@Param("organId") String organId,@Param("beginTime") String beginTime);

    List<BigDecimal> getSupplierSumByDepotHead(@Param("organId") String organId,@Param("billTime") Date billTime);

    List<BigDecimal> getSupplierSumByDepotItem(String organId, String id);
    List<BigDecimal> getSupplierSumByDepotHeadNoChangeAmount(String organId, String id);

    List<CheckVo> checkAlert(@Param("pageNum")Integer pageNum, @Param("pageSize")Integer pageSize);

    List<AccountHead> getAccountHeadListByHandsAddressIds(String[] addressIds);


    List<AccountHeadWithTransportReport> getAllBillByType(@Param("organId") String organId,
                                                          @Param("beginTime") String beginTime,
                                                          @Param("endTime") String endTime,
                                                          @Param("accountId")String accountId,
                                                          @Param("pageNum") Integer pageNum,
                                                          @Param("pageSize") Integer pageSize,
                                                          @Param("status") String status);
    int getAllBillByTypeCount(
            @Param("organId") String organId,
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("accountId")String accountId,
            @Param("status") String status);

    List<AccountItemWithTransport> getDetailByTransportNo(
            @Param("custom3") String custom3,
            @Param("type") String type);


    List<AccountHeadWithInvoice> getInvoiceAmountByType(@Param("organId") String organId,
                                                        @Param("beginTime") String beginTime,
                                                        @Param("endTime") String endTime,
                                                        @Param("accountId")String accountId,
                                                        @Param("pageNum") Integer pageNum,
                                                        @Param("pageSize") Integer pageSize,
                                                        @Param("status") String status,
                                                        @Param("billStatus") String billStatus);
    int getInvoiceAmountByTypeCount(
            @Param("organId") String organId,
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("accountId")String accountId,
            @Param("status") String status,
            @Param("billStatus") String billStatus);

    BigDecimal getDepositByNumber(
            @Param("number") String number,
            @Param("payStatus") String payStatus);

    Map<String,Object> getDepositChangeByNumber(
            @Param("number") String number,
            @Param("payStatus") String payStatus);

    AmountWithDeduction getAmountCollectedByNumber(
            @Param("number") String number);

    AccountHeadWithDeposit getDepositAndBillNoByNumber(
            @Param("number") String number,
            @Param("payStatus") String payStatus);

    List<AccountHeadWithDaily> getStatementByDaily();

    BigDecimal getRealAmount( @Param("type") String type,
                              @Param("number") String number,
                              @Param("headerId") String headerId,
                              @Param("billNo") String billNo);

    BigDecimal getEachAmount(  @Param("headerId") String headerId,
                              @Param("billId") String billId);

    Integer selectCheckSuperStatus(String id);

    Integer selectCheckBillNoStatus(String billNo);

    Integer selectFreightSuperStatus(String id);

    Integer selectSuperStatus(String id);

    BigDecimal inOrOutMoney(  @Param("beginTime") String beginTime,
                              @Param("endTime") String endTime,
                              @Param("type")String type);

    String getPaymentByBillId(
            @Param("billId") String billId,
            @Param("payStatus") String payStatus);

    String getDepositByLinkNumber(
            @Param("number") String number,
            @Param("payStatus") String payStatus);

    String getDepositByLinkNumberWithCustom9(
            @Param("number") String number,
            @Param("payStatus") String payStatus);

    String getDepositByHeadLinkNumber(
            @Param("number") String number,
            @Param("payStatus") String payStatus,
            @Param("changeStatus") String changeStatus);

    List<String> getCustom2ByBillId(
            @Param("billId") String billId,
            @Param("payStatus") String payStatus);

    String getDepositByCustom2(
            @Param("strList") List<String> strList);

    String getPaymentByBillIdList(
            @Param("idList") List<String> idList,
            @Param("payStatus") String payStatus);

    PaymentVo getPaymentByBillIdNotAccountName(@Param("billId") String billId,
                                               @Param("payStatus") String payStatus);

    BigDecimal getPaymentByHeadLinkNumber(
            @Param("number") String number,
            @Param("payStatus") String payStatus,
            @Param("changeStatus") String changeStatus);


}
